package com.ysu.yybk.service.impl;

import com.ysu.yybk.entity.checkin.CheckinError;
import com.ysu.yybk.form.ErrorFrom;
import com.ysu.yybk.mapper.checkin.CheckinErrorMapper;
import com.ysu.yybk.service.CheckinErrorService;
import com.ysu.yybk.util.DateConvertUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CheckinErrorServiceImpl implements CheckinErrorService {

    @Autowired
    private CheckinErrorMapper checkinErrorMapper;

    @Override
    public void writeError(ErrorFrom errorFrom) {

        CheckinError checkinError = new CheckinError();
        BeanUtils.copyProperties(errorFrom, checkinError);
        checkinError.setCreateTime(DateConvertUtil.date2Timestamp());
        checkinErrorMapper.insert(checkinError);
    }
}
